<template>
  <div class="home">
     <input type="text" v-focus="'666'">
     <div v-myshow="show">显示</div>
     <button @click="show=!show">切换显示隐藏</button>
  </div>
</template>
<script>
import { ref } from 'vue';
export default {
  name: 'HomeView',
  components: {

  },
  directives:{
    focus:{
      mounted(el,binging) {
        // console.log(el);
        // console.log(binging);
        el.focus();
      },
    },
    myshow:{
      mounted(el,binging){
        el.style.display = binging.value?'block':'none';
      },
      beforeUpdate(el, binding) {
        el.style.display = binding.value?'block':'none';
      }
    }
  },
  setup(props) {
    const show = ref(true);
    return {
      show
    }
  }
}
</script>
